<?php
require_once('includes/common.php');
//// Pre process to handle submitted values////////
unset($_POST['conPassword']);
$_POST['lang'] = implode(',',$_POST['lang']);
$_POST['hobbies'] = implode(',',$_POST['hobbies']);
$_POST['added_date'] = date('Y-m-d H:i:s');
//// FROM NOW $_POST is as we want////////
pr($_POST);

$insertQuery = "INSERT INTO `users` SET ";
foreach($_POST as $colName=>$value) {
  $insertQuery .="`$colName`='$value',";
}
$insertQuery = trim($insertQuery,', ');
echo $insertQuery;

$result = mysql_query($insertQuery) or die(mysql_error());

// to check how many records we inserted
pr( mysql_affected_rows());

// to get last inserted ID
pr( mysql_insert_id());







